<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<form class="page__content page__content-with-aside form" [formGroup]="contactForm" (ngSubmit)="submit()">
  <div class="main">
    <div class="page__box">
      <div class="page__box-title">
        <h3 class="title">{{ 'gv-contact.title' | translate }}</h3>
      </div>
      <div class="page__box-content">
        <gv-select
          *ngIf="!apiId"
          label="{{ 'gv-contact.apis.title' | translate }}"
          placeholder="{{ 'gv-contact.apis.label' | translate }}"
          [options]="apis"
          formControlName="api"
          name="api"
          class="form__control"
          ngDefaultControl
        >
        </gv-select>

        <gv-select
          label="{{ 'gv-contact.applications.title' | translate }}"
          placeholder="{{ 'gv-contact.applications.label' | translate }}"
          [options]="applications"
          formControlName="application"
          name="application"
          class="form__control"
          ngDefaultControl
        >
        </gv-select>

        <gv-input
          required
          label="{{ 'gv-contact.subject.title' | translate }}"
          placeholder="{{ 'gv-contact.subject.label' | translate }}"
          formControlName="subject"
          name="subject"
          class="form__control"
          ngDefaultControl
        >
        </gv-input>

        <gv-text
          required
          label="{{ 'gv-contact.content.title' | translate }}"
          placeholder="{{ 'gv-contact.content.label' | translate }}"
          formControlName="content"
          name="content"
          class="form__control"
          ngDefaultControl
        >
        </gv-text>

        <gv-checkbox
          label="{{ 'gv-contact.receiveCopy' | translate }}"
          formControlName="copy_to_sender"
          name="copy_to_sender"
          class="form__control"
          ngDefaultControl
        >
        </gv-checkbox>
      </div>
    </div>
  </div>

  <aside class="aside">
    <div class="page__box">
      <div class="page__box-title">
        <h4 class="title">{{ 'common.options' | translate }}</h4>
      </div>

      <div class="page__box-content form__actions">
        <gv-button
          type="submit"
          [disabled]="contactForm.invalid || contactForm.disabled"
          primary
          icon="communication:send"
          [loading]="isSending"
        >
          {{ 'gv-contact.button' | translate }}
        </gv-button>

        <gv-button outlined (:gv-button:click)="reset()" [disabled]="contactForm.pristine">
          {{ 'common.reset' | translate }}
        </gv-button>
      </div>
    </div>
  </aside>
</form>
